import Taro from '@tarojs/taro'
import { useEffect, useState } from 'react'

export default function useTheme() {
  const [theme, setTheme] = useState('light')
  const [background, setBackground] = useState('')
  const [color, setColor] = useState('')
  useEffect(() => {
    const systemInfo = Taro.getSystemInfoSync()

    setTheme(systemInfo.theme || 'light')
    setBackground(systemInfo.theme === 'dark' ? '#1F222A' : '#fff')
    setColor(systemInfo.theme === 'dark' ? '#eee' : '#232323')
  }, [])
  return { theme, background, color }
}
